package ModelLayer;

import java.util.ArrayList;

public class DVD
{
  private long id;
  private String title;
  private String artist;
  private String publicationDate;
  private ArrayList<Copy>copies;
  private int nrOfCopies;
  
    /**
     * Constructor for objects of class DVD
     */
    public DVD(long id,String title,String artist,String publicationDate)
    {
      copies=new ArrayList<Copy>();
      this.id=id;
      this.title=title;
      this.artist=artist;
      this.publicationDate=publicationDate;
      nrOfCopies=0;
      
    }
    
    
    
    /**
     * Add copy.
     */
    
    public void addCopy(Copy copy){
        
        copies.add(copy);
    }
    
    /**
     * Set and get methods.
     */
    
    
    public void setId(long id){
       
        this.id=id;
    }
    
    public long getId(){
        
        return this.id;
    }
    
    
    
    public void setTitle(String title){
        
        this.title=title;
    }
    
    public String getTitle(){
        
        return this.title;
    }
    
    
    
    public void setArtist(String artist){
        
        this.artist=artist;
    }
    
    public String getArtist(){
        
        return this.artist;
    }
    
    
    
    public void setPublicationDate(String date){
        
        this.publicationDate=date;
    }
    
    public String getPublicationDate(){
        
        return this.publicationDate;
    }
    
    
    /**
     * print information.
     */
    
    public void print(){
        System.out.println("ID:"+this.id+" ");
        System.out.println("Title:"+this.title+" ");
        System.out.println("Artist:"+this.artist+" ");
        System.out.println("Publication date:"+this.publicationDate+" ");
    }
    
    
     /**
     * Create copy.
     */
    
    public void createCopy(long dvdId,String serialNumber,String purchaseDate,double purchasePrice){
        
        Copy copy=new Copy(dvdId,serialNumber,purchaseDate,purchasePrice);
        copies.add(copy);
        nrOfCopies++;
    }
    
    public int nrOfCopies()
    {
        return nrOfCopies;
    }
    
    public void increaseNrOfCopies()
    {
        nrOfCopies++;
    }
    
    public void decreaseNrOfCopies()
    {
        nrOfCopies--;
    }
    
    public Copy getCopy()
    {
        return copies.get(nrOfCopies-1);
    }
    
    public ArrayList getListOfCopies()
    {
        return copies;
    }
    
    
    
    
    
} 
        

